<?php

namespace wxpay;

use app\common\model\Shop;
use think\Cache;

class PayConfig
{


    static $AppId;

    static $MchId;

    static $Key;

    static $AppSecret;

    static $SslCert_Path;

    static $SslKey_Path;


    public static function init()
    {
        $shop = new Shop();
        $config = $shop->where('status', 1)->order('id', 'desc')->find();
        if (!$config) throw new \Exception('暂无收款商户');
        static::$AppId = $config['appid'];
        static::$AppSecret = $config['appSecret'];
        static::$MchId = $config['mchid'];
        static::$Key = $config['payKey'];
        /* if (!empty($config['apiclient_cert'])) {
             static::$SslCert_Path = PUBLIC_PATH . $config['apiclient_cert'];
         }
         if (!empty($config['apiclient_key'])) {
             static::$SslKey_Path = PUBLIC_PATH . $config['apiclient_key'];
         }*/
    }

}

